Skip to content

Conversation

naseschwarz
Copy link
Owner

This Pull Request fixes/closes #{issue_num}.

It changes the following:

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

Naseschwarz added 2 commits March 19, 2025 12:11
This is a function that's solely used in testing and has no
dependencies into git2_hooks and panics on common errors.
It's a much better fit for git2-testing.
git2_hooks::create_hook is a function used in tests, which panics on common
errors. It can't really be moved into git2-testing, as it depends on
git2_hooks::hookspath::HookPaths.

In order to avoid accidental use, move the function into
git2_hooks::test_utils[_priv] and only publish it as git2_hooks::test_utils
if feature = "test-utils" is enabled.
@naseschwarz naseschwarz force-pushed the issue-2281-fix-2 branch 2 times, most recently from d7d1a2d to 29df53e Compare March 19, 2025 11:28
git supports relative values in core.hooksPath.

`man git-config`:

> A relative path is taken as relative to the directory where the hooks are
> run (see the "DESCRIPTION" section of githooks[5]).

`man githooks`:

> Before Git invokes a hook, it changes its working directory to either
> $GIT_DIR in a bare repository or the root of the working tree in a >
> non-bare repository.

I.e. relative paths in core.hooksPath in non-bare repositories are always
relative to GIT_WORK_TREE.

There is a further exception; I believe this is not considered for path
resolution:

> An exception are hooks triggered during a push (pre-receive, update,
> post-receive, post-update, push-to-checkout) which are always executed
> in $GIT_DIR.
@naseschwarz naseschwarz force-pushed the issue-2281-fix-2 branch 2 times, most recently from fdf65a8 to cda17c7 Compare March 19, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants